package com.funcas.pcloud.upms.entity;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.ToStringSerializer;
import com.alibaba.fastjson.annotation.JSONType;
import com.baomidou.mybatisplus.annotation.TableName;
import com.funcas.pcloud.common.BaseEntity;
import com.google.common.collect.Sets;
import lombok.Data;

import java.util.Objects;
import java.util.Set;

/**
 * @author funcas
 * @version 1.0
 * @date 2018年04月09日
 */
@JSONType(ignores = {"parent"})
@Data
@TableName("tb_resource")
public class Resource extends BaseEntity<Long> {

    private String component;
    private String permission;
    private String remark;
    private Integer sort;
    private String name;
    private Integer type;
    private String value;
    @JSONField(serializeUsing = ToStringSerializer.class)
    private Long fkParentId;
    private String icon;
    private transient Set<Resource> children = Sets.newLinkedHashSet();

    private transient Resource parent;

}
